<?php
/**
 * Created by PhpStorm.
 * User: yy
 * Date: 2016/11/18
 * Time: 17:13
 */

namespace App;

use App\Plugins\PluginInfo;

trait PluginFields
{
    public function pluginAllowFields() {
        $pluginInfo = PluginInfo::getInstance();
        if ($pluginInfo->getPlugin()) {
            $class_arr = explode('\\', __CLASS__);
            $class_name = $class_arr[count($class_arr) - 1];
            $namespace = $pluginInfo->getNamespace() . '\\Models\\' . $class_name;
            return $namespace::getAllowFields();
        }
        return [];
    }
}